<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace app\admin\controller;

use cmf\controller\AdminBaseController;
use think\Db;
use tree\Tree;
use app\admin\model\AdminMenuModel;

class RecruitController extends AdminBaseController
{

    public function index()
    {
        $data = Db::name('recruit')->order(["list_order" => "ASC", "id" => "DESC"])->select();
        $this->assign("recruits", $data);
        return $this->fetch();
    }

    public function add()
    {
        return $this->fetch();
    }

    public function addPost()
    {
        if ($this->request->isPost()) {
            $data = $this->request->param();
            $data['recruit']['create_time'] = time();
            Db::name('Recruit')->strict(false)->field(true)->insert($data['recruit']);
            $this->success("添加成功！", url("Recruit/index"));
        }
    }

    public function delete()
    {
        $intId = $this->request->param("id", 0, "intval");

        if (empty($intId)) {
            $this->error(lang("NO_ID"));
        }

        Db::name('Recruit')->where(["id" => $intId])->delete();
        $this->success(lang("DELETE_SUCCESS"), url("Recruit/index"));

    }
}

